﻿<html>

	<head>
		<title>单位管理</title>
		<meta charset="utf-8">
		<meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
		<meta name="format-detection" content="telephone=no,email=no,date=no,address=no">

		<link href="../../css/skin/default/style.css" rel="stylesheet" type="text/css" />
		<link rel="stylesheet" href="../../css/dialog.css">
		<link href="../../js/lib/ligerUI/skins/Aqua/css/ligerui-all.css" rel="stylesheet" type="text/css" />

		<script src="../../js/lib/jquery/jquery-1.10.2.min.js" type="text/javascript"></script>
		<script src="../../js/lib/ligerUI/js/ligerui.all.js" type="text/javascript"></script>

		<script src="../../js/lib/ligerUI/js/plugins/ligerPopupEdit.js"></script>
		<script src="../../js/lib/ligerUI/js/plugins/ligerLayout.js" type="text/javascript"></script>
		<script src="../../js/lib/ligerUI/js/plugins/ligerGrid.js" type="text/javascript"></script>
		<script src="../../js/lib/ligerUI/js/plugins/ligerForm.js" type="text/javascript"></script>
		<script src="../../js/lib/ligerUI/js/plugins/ligerCheckBox.js" type="text/javascript"></script>
		<script src="../../js/lib/ligerUI/js/plugins/ligerComboBox.js" type="text/javascript"></script>
		<script src="../../js/lib/ligerUI/js/plugins/ligerDateEditor.js" type="text/javascript"></script>
		<script src="../../js/lib/ligerUI/js/plugins/ligerRadio.js" type="text/javascript"></script>
		<script src="../../js/lib/ligerUI/js/plugins/ligerTextBox.js" type="text/javascript"></script>
		<script src="../../js/lib/ligerUI/js/plugins/ligerSpinner.js" type="text/javascript"></script>
		<script src="../../js/lib/ligerUI/js/plugins/ligerTree.js" type="text/javascript"></script>
		<script src="../../js/lib/ligerUI/js/plugins/ligerDialog.js" type="text/javascript"></script>
		<script src="../../js/lib/ligerUI/js/plugins/ligerDrag.js" type="text/javascript"></script>
		<script src="../../js/lib/ligerUI/js/plugins/ligerResizable.js" type="text/javascript"></script>
		<script src="../../js/lib/ligerUI/js/plugins/ligerTip.js" type="text/javascript"></script>
		<script src="../../js/lib/ligerUI/js/plugins/ligerMenu.js" type="text/javascript"></script>
		<script src="../../js/lib/ligerUI/js/plugins/ligerToolBar.js" type="text/javascript"></script>
		<script src="../../JS/XHD.js" type="text/javascript"></script>
		<script src="../../js/lib/jquery.form.js" type="text/javascript"></script>
		<script src="../../js/lib/json2.js" type="text/javascript"></script>
		<script src="../../js/dialog.js"></script>
		<script src="../../js/JS/layout.js"></script>
		<script src="../../js/constants.js" type="text/javascript"></script>
		<script src="../../js/api.js" type="text/javascript"></script>

		<script type="text/javascript">
			var manager;
			$(document).hover(parent.hindMenu);
			var mid = $api.getparastr('mid');
			var unitUrl = BaseUrl + "ProductUnit?token=" + $api.getStorage("token");
			$(function() {

				toolbar();
				manager = $("#maingrid4").ligerGrid({
					columns: [{
							display: '编号',
							name: 'Fid',
							width: 80
						},
						{
							display: '名称',
							name: 'Fname',
							width: 160,
							align: 'center'
						},
						{
							display: '助记码',
							name: 'Fmcode',
							width: 180,
							align: 'left'
						},
						{
							display: '创建时间',
							name: 'Fdate',
							minWidth: 300,
							render: function(rowdata, rowindex, value) {
								return $api.formatCTime(rowdata.Fdate);

							}
						}
					],
					dataAction: 'local',
					url: unitUrl,
					width: '100%',
					height: '95%',
					method: 'get',
					pageSize: 50,
					usePager: true,
					onDblClickRow: function(data, rowindex, rowobj) {
						parent.openCommWindow('vstore/tb_product_unit/Add.html?data=' + escape(JSON.stringify(data)), "商品单位", 320, 300, 'unit');

					}
				});
			});

			function toolbar() {
				$api.getLimit(mid, 0, function(data) {
					$("#icon-list").append(data);
				});
			}

			function f_reload() {
				var manager = $("#maingrid4").ligerGetGridManager();
				manager.loadData(true);
			};

			function add() {
				parent.openCommWindow('vstore/tb_product_unit/Add.html', "商品单位", 320, 300, 'unit');
			}

			function edit() {
				var manager = $("#maingrid4").ligerGetGridManager();
				var row = manager.getSelectedRow();
				if(row) {
					parent.openCommWindow('vstore/tb_product_unit/Add.html?data=' + escape(JSON.stringify(row)), "商品单位", 320, 300, 'unit');
				} else {
					$.ligerDialog.warn("请选择行");
				}
			}

			function del() {
				var manager = $("#maingrid4").ligerGetGridManager();
				var row = manager.getSelectedRow();
				if(row) {
					$.ligerDialog.confirm("商品单位删除后不能恢复，\n您确定要移除？", function(yes) {
						if(yes) {
							var url = unitUrl + "&action=del";

							$api.ajax2(url, row, function(data) {
								f_reload();
							});
						}
					})
				} else {
					$.ligerDialog.warn("请选择行！");
				}
			}

			function saveInfo(row, cmd) {
				if(cmd == 'unit') {
					var url = unitUrl + "&action=" + row.action;

					$api.ajax2(url, row.data, function(data) {
						f_reload();
					});
				}

			}
		</script>

	</head>

	<body class="mainbody">
		<form id="form1" onsubmit="return false">
			<div>
				<div class="toolbar-wrap">
					<div class="toolbar">
						<div class="l-list">
							<ul id="icon-list" class="icon-list">
							</ul>
						</div>

					</div>
				</div>
				<div id="maingrid4" style="margin: 0px;background:#fff;"></div>
			</div>
		</form>

	</body>

</html>